FROM nginx:1.27-alpine
LABEL maintainer="itps.wen" description="Nginx for React App with custom config"

# 设置时区和语言
ENV TZ="Asia/Shanghai" \
    LANG="C.UTF-8"

# 删除默认配置文件
RUN rm -rf /etc/nginx/conf.d/*

# 拷贝你的自定义 nginx.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf

# 拷贝前端构建好的静态资源到 Nginx 默认目录
# 如果是 React：build/
# 如果是 Vue：dist/
COPY dist/ /usr/share/nginx/html/

# 拷贝 SSL 证书
COPY ssl/ /etc/nginx/ssl/

# 暴露 80 和 443 端口
EXPOSE 80 443

# 容器启动命令
CMD ["nginx", "-g", "daemon off;"]